home *** CD-ROM | disk | FTP | other *** search
- /* Reposition 320
- ** --------------
- ** This example has a mobile 320x256 screen, which is attached to the joystick.
- ** Notice that if you move the screen to extreme values, the display will NOT
- ** like it. The lack of checking is for speed - if you want limits, it's up
- ** to you to check for them.
- **
- ** To exit the example, press fire.
- */
-
- MODULE 'games','games/games'
-
- PROC main()
- DEF screen:PTR TO gamescreen, palette:PTR TO INT, joy:LONG,
- loadpic:PTR TO picture
-
- palette := [ $0000,$0130,$0FCB,$0FA9,$0D88,$0965,$0644,$0211,
- $0400,$0444,$0FF0,$0432,$0CC0,$0150,$0501,$0880,
- $0261,$0271,$0382,$0492,$05A3,$05B4,$0677,$06C4,
- $0788,$09AA,$0BCC,$0801,$0901,$0A02,$0701,$0601
- ]:INT;
-
- screen := [ GSV1,0,
- 0,0,0, -> Screen_Mem1/2/3
- 0, -> Screen link.
- palette, -> Address of palette.
- 0, -> Address of rasterlist.
- 32, -> Amt of colours in palette.
- 320,256,320,256, -> Screen & Pic Height/Width.
- 5, -> Amt of planes.
- 0,0, -> Top of screen offsets, X/Y
- 0,0, -> X/Y counters (for scrolling).
- 0, -> Special attributes.
- LORES, -> Screen mode.
- INTERLEAVED, -> Screen type
- 0 -> Reserved area.
- ]:gamescreen;
-
- loadpic := [ PCV1,0, -> Version header.
- 0, -> Destination.
- 320,256, -> Width, Height.
- 5, -> Amount of Planes.
- 32, -> Amount of colours.
- palette, -> Palette (remap).
- LORES, -> Screen mode.
- INTERLEAVED, -> Destination.
- 0 -> Parameters.
- ]:picture;
-
- IF gmsbase := OpenLibrary('games.library',0)
- SetUserPri()
- IF (Add_Screen(screen) = ERR_OK)
- loadpic.data := screen.memptr1;
- IF (LoadPic('GAMESLIB:data/IFF.Pic320',loadpic) = ERR_OK)
- Show_Screen(screen)
-
- REPEAT
- joy := Read_JoyPort(JPORT2,JT_SWITCH)
- IF (joy AND JS_RIGHT) THEN screen.scrxoffset := screen.scrxoffset+1
- IF (joy AND JS_LEFT) THEN screen.scrxoffset := screen.scrxoffset-1
- IF (joy AND JS_UP) THEN screen.scryoffset := screen.scryoffset-1
- IF (joy AND JS_DOWN) THEN screen.scryoffset := screen.scryoffset+1
- Wait_OSVBL()
- Remake_Screen(screen)
- UNTIL !(joy AND JS_FIRE1)
-
- ENDIF
- Delete_Screen(screen)
- ENDIF
- CloseLibrary(gmsbase)
- ENDIF
- ENDPROC
-
-